<local:DocumentBase x:Class="WPFExcelReport.YCAEK03DOC"
                    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:local="clr-namespace:ReflectionStudio.Components.UserControls;assembly=ReflectionStudio.Core"                    
                    xmlns:db="clr-namespace:INTEX.DataBase"
                    xmlns:Localization="clr-namespace:Localization;assembly=Localization" 
                    xmlns:ucd="clr-namespace:ReflectionStudio.Controls;assembly=ReflectionStudio.Controls"
                    xmlns:wep="clr-namespace:WPFExcelReport" 
                    Loaded="Window_Loaded"
                    Background="White" 
     >
    <local:DocumentBase.Resources>
        <ucd:Divideby10  x:Key="d10"/>
        <ucd:Divideby100  x:Key="d100"/>
        <ucd:Divideby1000  x:Key="d1000"/>
        <ucd:PNumConverter  x:Key="pnum"/>
        <ucd:TextTrimmingConverter  x:Key="Trim"/>
        <ucd:GB2312Convert8859P1  x:Key="gb2312"/>
        <db:SETINTEXDB  x:Key="SetData" />
        <db:SETINTEXDB  x:Key="SetEnv" />
        <db:SETINTEXDB  x:Key="Set4ITX" />
        <db:SETINTEXDB  x:Key="SetDetail" />
        <CollectionViewSource   x:Key="vwLIEFDAT" Source="{Binding Path=LIEFDAT,Source={StaticResource SetEnv}}" />
        <CollectionViewSource   x:Key="vwEKKOPF" Source="{Binding Path=EKKOPF,Source={StaticResource SetData}}" />
        <CollectionViewSource   x:Key="vwEKVRECH" Source="{Binding Path=EKVRECH,Source={StaticResource SetData}}" />
        <CollectionViewSource   x:Key="vwTmpEKVRECH" Source="{Binding Path=EKVRECH,Source={StaticResource Set4ITX}}" />
        <CollectionViewSource   x:Key="vwTEKKOPF" Source="{Binding Path=EKKOPF,Source={StaticResource Set4ITX}}" />
        <CollectionViewSource   x:Key="vwEKPOS" Source="{Binding Path=ICC_EKPOS,Source={StaticResource Set4ITX}}" />
        <CollectionViewSource   x:Key="vwWASTAMM" Source="{Binding Path=WASTAMM,Source={StaticResource Set4ITX}}" />
        <CollectionViewSource   x:Key="vwABAUFM" Source="{Binding Path=ICC_ABAUFM,Source={StaticResource Set4ITX}}" />
    </local:DocumentBase.Resources>
    <TabControl>
        <TabItem Header="{Binding Source={Localization:Translate Word=采购单管理}}">
            <Grid   >
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="1*" />
                    <RowDefinition Height="1*" />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="200"></ColumnDefinition>
                    <ColumnDefinition Width="1000"></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <StackPanel Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2"
            Orientation="Horizontal" >
                    <TextBlock FontSize="18"    Height="40" Width="Auto" Name="txt1" VerticalAlignment="Center" Margin="0,0,0,0"  Text="{Binding Source={Localization:Translate Word=采购单}}" />
                    <TextBox Background="Yellow"  FontSize="18"    Width="40" Name="txtABPAUFKRS" CharacterCasing="Upper" Margin="10,0,0,0"  Height="30"
                     MaxLength="2"/>
                    <!--Text="{Binding EKPAUFKRS, Source={ StaticResource ResourceKey=vwEKPOS}}" />-->
                    <TextBox Background="White" BorderBrush="Azure"  FontSize="18"    Margin="10,0,0,0" Width="80" Name="txtABPAUFLFD"    Height="30"
                     MaxLength="6"/>
                    <!--Text="{Binding EKPAUFLFD, Source={ StaticResource ResourceKey=vwEKPOS}}" />-->
                    <!--<ComboBox  ItemsSource="{Binding Source={StaticResource ResourceKey=vwLIEFDAT}}"
                            Margin="20,0,0,0"
                       Background="Gray"  MinWidth="100" 
                       DisplayMemberPath="LSLIEFNA"
                       IsEditable="True"
                       SelectedValuePath="LSLIEFNR"
                       >
            </ComboBox>-->
                    <TextBlock Text="{Binding Source={Localization:Translate Word=包含付款信息}}" VerticalAlignment="Center"></TextBlock>
                    <CheckBox Name="ChkPayment" IsChecked="True" VerticalAlignment="Center" 
                          Background="White"
                          >
                        <CheckBox.LayoutTransform>
                            <ScaleTransform ScaleX="2" ScaleY="2" />
                        </CheckBox.LayoutTransform>
                    </CheckBox>
                    <TextBlock Text="{Binding Source={Localization:Translate Word=未确认数量}}" VerticalAlignment="Center"></TextBlock>
                    <CheckBox Name="ChkALL" IsChecked="True" VerticalAlignment="Center" 
                          Background="White"
                          >
                        <CheckBox.LayoutTransform>
                            <ScaleTransform ScaleX="2" ScaleY="2" />
                        </CheckBox.LayoutTransform>
                    </CheckBox>
                    <TextBlock Text="{Binding Source={Localization:Translate Word=已经确认数量}}" VerticalAlignment="Center"></TextBlock>
                    <CheckBox Name="ChkEKPBEKZ" IsChecked="False" VerticalAlignment="Center" 
                          Background="White"
                          >
                        <CheckBox.LayoutTransform>
                            <ScaleTransform ScaleX="2" ScaleY="2" />
                        </CheckBox.LayoutTransform>
                    </CheckBox>
                    <TextBlock Text="{Binding Source={Localization:Translate Word=已经付款}}" VerticalAlignment="Center"></TextBlock>
                    <CheckBox Name="ChkEKPKNTRNRL" IsChecked="False" VerticalAlignment="Center" 
                          Background="White"
                          >
                        <CheckBox.LayoutTransform>
                            <ScaleTransform ScaleX="2" ScaleY="2" />
                        </CheckBox.LayoutTransform>
                    </CheckBox>
                    <TextBlock Text="{Binding Source={Localization:Translate Word=发料清单}}" VerticalAlignment="Center"></TextBlock>
                    <CheckBox Name="ChkNoControl" IsChecked="False" VerticalAlignment="Center" 
                          Background="White"
                          >
                        <CheckBox.LayoutTransform>
                            <ScaleTransform ScaleX="2" ScaleY="2" />
                        </CheckBox.LayoutTransform>
                    </CheckBox>
                    <Button FontSize="18" Content="{Binding Source={Localization:Translate Word=查询}}"  BorderBrush="Yellow" Margin="20,0,0,0" Name="butGetData" Click="btnQuery_Click" Height="40" Width="40"></Button>
                    <Button FontSize="18" Content="{Binding Source={Localization:Translate Word=部分请款}}"  BorderBrush="Yellow" Margin="20,0,0,0" Name="butSTARTAPP"   Click="cmdStartApply_Click" Height="40" Width="Auto"></Button>
                    <!--<Button FontSize="18" Content="{Binding Source={Localization:Translate Word=全部请款}}"  BorderBrush="Yellow" Margin="20,0,0,0"   Click="cmdStartAllApply_Click" Height="40" Width="Auto"></Button>-->
                    <Button FontSize="18" Content="{Binding Source={Localization:Translate Word=完成请款}}"  BorderBrush="Yellow" Margin="20,0,0,0" Name="butENDAPP" Click="cmdEndApply_Click" Height="40" Width="Auto"></Button>
                    <Button Content="{Binding Source={Localization:Translate Word=打印}}"  FontSize="18"   BorderBrush="Yellow" Margin="20,0,0,0"  Name="btnPrint" Width="Auto" Click="btnPrint_Click"/>
                    <Button Content="{Binding Source={Localization:Translate Word=复杂}}"  FontSize="18"   BorderBrush="Yellow" Margin="20,0,0,0"   Width="Auto" Click="btnPrintEx_Click"/>
                     </StackPanel>
                <DataGrid Grid.Row="1" Grid.Column="0" CanUserReorderColumns="True"  
                              CanUserResizeRows="True" CanUserSortColumns="True"                  
                              AutoGenerateColumns="False"   
                              EnableRowVirtualization="True"  
                              RowDetailsVisibilityMode="VisibleWhenSelected" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
                              IsSynchronizedWithCurrentItem="True" Opacity="10" Visibility="Visible"
                              ItemsSource="{Binding Source={StaticResource ResourceKey=vwEKKOPF}}" 
                              Margin="0,1,0,0" >
                    <DataGrid.Columns>
                        <DataGridTextColumn Header="" Binding="{Binding EKKAUFKRS}" Width="40"/>
                        <DataGridTextColumn Header="{Binding Source={Localization:Translate Word=采购单}}" Binding="{Binding EKKAUFLFD}" Width="80"/>
                    </DataGrid.Columns>
                </DataGrid  >
                <DockPanel Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="2" Grid.RowSpan="2">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="1*" />
                            <RowDefinition Height="1*" />
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="1*"></ColumnDefinition>
                            <ColumnDefinition Width="1*"/>
                        </Grid.ColumnDefinitions>
                        <DataGrid      Grid.Row="0"      Grid.Column="0" Grid.ColumnSpan="2" 
                    CanUserReorderColumns="True"  
                                       MaxHeight="300"
                              CanUserResizeRows="True" CanUserSortColumns="True"                  
                              AutoGenerateColumns="False"   
                              EnableRowVirtualization="True"  
                              RowDetailsVisibilityMode="VisibleWhenSelected" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
                              IsSynchronizedWithCurrentItem="True" Opacity="10" Visibility="Visible"
                              ItemsSource="{Binding Source={StaticResource ResourceKey=vwEKPOS}}"  
                               >
                            <DataGrid.Columns>
                                <DataGridTextColumn Header="" Binding="{Binding EKPAUFKRS}" Width="Auto"/>
                                <DataGridTextColumn Header="{Binding Source={Localization:Translate Word=采购单}}" Binding="{Binding EKPAUFLFD}" Width="Auto"/>
                                <DataGridTextColumn Header="" Binding="{Binding EKPAUFPOS}" Width="Auto"/>
                                <DataGridTextColumn Header="{Binding Source={Localization:Translate Word=品种}}" Binding="{Binding EKPART}" Width="Auto"/>
                                <DataGridTextColumn Header="{Binding Source={Localization:Translate Word=色号}}" Binding="{Binding EKPFARBE}" Width="Auto"/>
                                <DataGridTextColumn Header="{Binding Source={Localization:Translate Word=尺寸}}" Binding="{Binding EKPGROE}" Width="Auto"/>
                                <DataGridTextColumn Header="{Binding Source={Localization:Translate Word=数量}}" Binding="{Binding Path=EKPME1, Converter={StaticResource ResourceKey=d100}}" Width="Auto"/>
                                <DataGridTextColumn Header="{Binding Source={Localization:Translate Word=总金额}}" Binding="{Binding Path=EKPWE1, Converter={StaticResource ResourceKey=d100}}" Width="Auto"/>
                                <DataGridTextColumn Header="{Binding Source={Localization:Translate Word=单价}}" Binding="{Binding Path=EKPPRME, Converter={StaticResource ResourceKey=d1000}}" Width="Auto"/>
                                <DataGridTextColumn Header="{Binding Source={Localization:Translate Word=交期}}" Binding="{Binding EKPLTERM}" Width="Auto"/>
                            </DataGrid.Columns>
                        </DataGrid  >
                        <StackPanel  Grid.Row="1"    Grid.Column="0" Grid.ColumnSpan="2"  >
                            <WrapPanel>
                                <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                                </Grid.ColumnDefinitions>
                                <TextBlock Grid.Column="0" Text="{Binding Source={Localization:Translate Word=申请金额}}"  FontSize="18" Height="40"></TextBlock>
                                 <TextBox  Grid.Column="1" Name="txtApply" Text="{Binding Path=EKVBETRAG, Source={StaticResource ResourceKey=vwTmpEKVRECH},Converter={StaticResource ResourceKey=d100}}" Width="100" FontSize="18" Height="40"></TextBox>
                            </Grid>
                                <Grid>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                                    </Grid.ColumnDefinitions>
                                    <TextBlock Grid.Column="0" Text="{Binding Source={Localization:Translate Word=尾款}}"  FontSize="18" Height="40"></TextBlock>
                                    <TextBox  Grid.Column="1" Name="txtLastApp" Text="N" Width="24" FontSize="18" Height="40"></TextBox>
                                </Grid>
                            </WrapPanel>
                            <DataGrid Name="dlgTmpEKVRECH" 
                    MaxHeight="200"
                    CanUserReorderColumns="True"  
                              CanUserResizeRows="True" CanUserSortColumns="True"                  
                              AutoGenerateColumns="False"   
                              EnableRowVirtualization="True"  
                              RowDetailsVisibilityMode="VisibleWhenSelected" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
                              IsSynchronizedWithCurrentItem="True" Opacity="10" 
                              ItemsSource="{Binding Source={StaticResource ResourceKey=vwTmpEKVRECH}}"  
                               >
                                <DataGrid.Columns>
                                    <DataGridTextColumn Header="{Binding Source={Localization:Translate Word=申请号}}" Binding="{Binding EKVABLAGE}" Width="Auto"/>
                                    <DataGridTextColumn Header="" Binding="{Binding EKVBELEG,Converter={StaticResource ResourceKey=pnum}}" Width="Auto"/>
                                    <DataGridTextColumn Header="{Binding Source={Localization:Translate Word=金额}}" Binding="{Binding EKVBETRAG,Converter={StaticResource ResourceKey=d100}}" Width="Auto"/>
                                    <DataGridTextColumn Header="{Binding Source={Localization:Translate Word=采购单}}" Binding="{Binding EKVFILLER,Converter={StaticResource ResourceKey=Trim}}" Width="Auto"/>
                                    <DataGridTextColumn Header="{Binding Source={Localization:Translate Word=次数}}" Binding="{Binding EKVAENDZL}" Width="Auto"/>
                                    <DataGridTextColumn Header="{Binding Source={Localization:Translate Word=申请日期}}" Binding="{Binding Path=EKVNEUDAT}" Width="Auto"/>
                                    <DataGridTextColumn Header="{Binding Source={Localization:Translate Word=申请}}" Binding="{Binding Path=EKVNEUBEN}" Width="Auto"/>
                                    <DataGridTextColumn Header="{Binding Source={Localization:Translate Word=付款日期}}" Binding="{Binding Path=EKVAENDDAT}" Width="Auto"/>
                                    <DataGridTextColumn Header="{Binding Source={Localization:Translate Word=付款人}}" Binding="{Binding Path=EKVAENDBEN}" Width="Auto"/>
                                    <DataGridTextColumn Header="{Binding Source={Localization:Translate Word=付款}}" Binding="{Binding EKVKIR}" Width="Auto"/>
                                </DataGrid.Columns>
                            </DataGrid  >
                            <DataGrid Name="dlgEKVRECH" IsEnabled="False"
                    CanUserReorderColumns="True"  
                              CanUserResizeRows="True" CanUserSortColumns="True"                  
                              AutoGenerateColumns="False"   
                              EnableRowVirtualization="True"  
                              RowDetailsVisibilityMode="VisibleWhenSelected"  MaxHeight="200"
                              IsSynchronizedWithCurrentItem="True" Opacity="10" 
                              ItemsSource="{Binding Source={StaticResource ResourceKey=vwEKVRECH}}" 
                               >
                                <DataGrid.Columns>
                                    <DataGridTextColumn Header="{Binding Source={Localization:Translate Word=申请号}}" Binding="{Binding EKVABLAGE}" Width="Auto"/>
                                    <DataGridTextColumn Header="" Binding="{Binding EKVBELEG,Converter={StaticResource ResourceKey=pnum}}" Width="Auto"/>
                                    <DataGridTextColumn Header="{Binding Source={Localization:Translate Word=金额}}" Binding="{Binding EKVBETRAG,Converter={StaticResource ResourceKey=d100}}" Width="Auto"/>
                                    <DataGridTextColumn Header="{Binding Source={Localization:Translate Word=采购单}}" Binding="{Binding EKVFILLER,Converter={StaticResource ResourceKey=Trim}}" Width="Auto"/>
                                    <DataGridTextColumn Header="{Binding Source={Localization:Translate Word=次数}}" Binding="{Binding EKVAENDZL}" Width="Auto"/>
                                    <DataGridTextColumn Header="{Binding Source={Localization:Translate Word=申请日期}}" Binding="{Binding Path=EKVNEUDAT}" Width="Auto"/>
                                    <DataGridTextColumn Header="{Binding Source={Localization:Translate Word=申请}}" Binding="{Binding Path=EKVNEUBEN}" Width="Auto"/>
                                    <DataGridTextColumn Header="{Binding Source={Localization:Translate Word=付款日期}}" Binding="{Binding Path=EKVAENDDAT}" Width="Auto"/>
                                    <DataGridTextColumn Header="{Binding Source={Localization:Translate Word=付款人}}" Binding="{Binding Path=EKVAENDBEN}" Width="Auto"/>
                                    <DataGridTextColumn Header="{Binding Source={Localization:Translate Word=付款}}" Binding="{Binding EKVKIR}" Width="Auto"/>
                                </DataGrid.Columns>
                            </DataGrid  >
                        </StackPanel>
                    </Grid>
                </DockPanel>
            </Grid>
        </TabItem>
        <TabItem Header="{Binding Source={Localization:Translate Word=发料清单}}">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"></RowDefinition>
                    <RowDefinition Height="1*"></RowDefinition>
                    <RowDefinition Height="1*"></RowDefinition>
                </Grid.RowDefinitions>
                <WrapPanel Grid.Row="0">
                    <Button Content="{Binding Source={Localization:Translate Word=打印发料单}}" Click="btnSendClick_Click"></Button>
                    <TextBlock Text="请选择一行采购单和一个留位行,该留位行对应的物料是产生发料单的依据" Margin="10,0,0,0"></TextBlock>
                </WrapPanel>
                
                <DataGrid
                    Grid.Row="1"                   
                    CanUserReorderColumns="True"  
                    CanUserResizeRows="True" CanUserSortColumns="True"                  
                    AutoGenerateColumns="False"   
                    EnableRowVirtualization="True"  
                    RowDetailsVisibilityMode="VisibleWhenSelected" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
                    IsSynchronizedWithCurrentItem="True" Opacity="10" Visibility="Visible"
                    ItemsSource="{Binding Source={StaticResource ResourceKey=vwEKPOS}}"  
                    >
                    <DataGrid.Columns>
                        <DataGridTextColumn Header="" Binding="{Binding EKPAUFKRS}" Width="Auto"/>
                        <DataGridTextColumn Header="{Binding Source={Localization:Translate Word=采购单}}" Binding="{Binding EKPAUFLFD}" Width="Auto"/>
                        <DataGridTextColumn Header="" Binding="{Binding EKPAUFPOS}" Width="Auto"/>
                        <DataGridTextColumn Header="{Binding Source={Localization:Translate Word=品种}}" Binding="{Binding EKPART}" Width="Auto"/>
                        <DataGridTextColumn Header="{Binding Source={Localization:Translate Word=色号}}" Binding="{Binding EKPFARBE}" Width="Auto"/>
                        <DataGridTextColumn Header="{Binding Source={Localization:Translate Word=尺寸}}" Binding="{Binding EKPGROE}" Width="Auto"/>
                        <DataGridTextColumn Header="{Binding Source={Localization:Translate Word=数量}}" Binding="{Binding Path=EKPME1, Converter={StaticResource ResourceKey=d100}}" Width="Auto"/>
                        <DataGridTextColumn Header="{Binding Source={Localization:Translate Word=单价}}" Binding="{Binding Path=EKPPRME, Converter={StaticResource ResourceKey=d1000}}" Width="Auto"/>
                        <DataGridTextColumn Header="{Binding Source={Localization:Translate Word=交期}}" Binding="{Binding EKPLTERM}" Width="Auto"/>
                    </DataGrid.Columns>
                </DataGrid  >
                <DataGrid CanUserReorderColumns="True"  
                      Name="dlgABA"
                              CanUserResizeRows="True" CanUserSortColumns="True"                  
                              AutoGenerateColumns="False"   
                              EnableRowVirtualization="True"  
                              FontSize="12"
                              MaxHeight="300"
                              RowDetailsVisibilityMode="VisibleWhenSelected" HorizontalAlignment="Stretch"  
                              IsSynchronizedWithCurrentItem="True" Opacity="10" Visibility="Visible"
                              ItemsSource="{Binding Source={StaticResource ResourceKey=vwABAUFM}}"  
                              Grid.ColumnSpan="4" Margin="0,1,0,0" Grid.Row="2">
                    <DataGrid.Columns>
                        <DataGridTextColumn Header="{Binding Source={Localization:Translate Word=ID}}" Binding="{Binding ABAID}" Width="Auto"/>
                        <DataGridTextColumn Header="" Binding="{Binding ABAAUFKRS}" Width="40"/>
                        <DataGridTextColumn Header="{Binding Source={Localization:TranslateExtension Word=采购单}}" Binding="{Binding ABAAUFLFD}" Width="80"/>
                        <DataGridTextColumn Header="" Binding="{Binding ABAAUFPOS}" Width="40"/>
                        <DataGridTextColumn Header="{Binding Source={Localization:TranslateExtension Word=原料}}" Binding="{Binding ABAART}" Width="160"/>
                        <DataGridTextColumn Header="{Binding Source={Localization:TranslateExtension Word=色号}}" Binding="{Binding ABAFARBE}" Width="80"/>
                        <DataGridTextColumn Header="{Binding Source={Localization:TranslateExtension Word=尺寸}}" Binding="{Binding ABAGROE}" Width="80"/>
                        <DataGridTextColumn Header="{Binding Source={Localization:TranslateExtension Word=原料}}" Binding="{Binding ABPART}" Width="160"/>
                        <DataGridTextColumn Header="{Binding Source={Localization:TranslateExtension Word=色号}}" Binding="{Binding ABPFARBE}" Width="80"/>
                        <DataGridTextColumn Header="{Binding Source={Localization:TranslateExtension Word=需求数量}}" Binding="{Binding Path=ABARESMG}" Width="80"/>
                        <DataGridTextColumn Header="{Binding Source={Localization:TranslateExtension Word=计划数量}}" Binding="{Binding Path=ABAQTYRESERVE}" Width="80"/>
                        <DataGridTextColumn  Binding="{Binding ABAVKAUFKRS}" Width="160"/>
                        <DataGridTextColumn Header="{Binding Source={Localization:TranslateExtension Word=生产单}}" Binding="{Binding ABAVKAUFLFD}" Width="80"/>
                    </DataGrid.Columns>
                </DataGrid  >
            </Grid>
        </TabItem>
    </TabControl>  
</local:DocumentBase>
